package controller

import (
	"fmt"
	"net/http"
	"tiktok2023/model"
	"tiktok2023/service"

	"github.com/gin-gonic/gin"
)

type VideoListResponse struct {
	model.Response
	VideoList []VedioTemp `json:"video_list"`
}

// Publish check token then save upload file to public directory
func Publish(c *gin.Context) {
	pub := service.PublishService{}
	resp, _ := pub.HandlePublish(c)
	c.JSON(http.StatusOK, resp)
}

// PublishList all users have same publish video list
func PublishList(c *gin.Context) {
	pub := service.PublishService{}
	resp, err := pub.HandlePublishList(c)
	if err != nil {
		c.JSON(http.StatusOK, model.Response{
			StatusCode: 1,
			StatusMsg:  fmt.Sprintf("%v", err),
		})
		return
	}
	c.JSON(http.StatusOK, resp)
}
